package com.milhouz.quizzdroid.bean;

import android.database.Cursor;

import com.milhouz.quizzdroid.db.QuizzDroidConstants;

public class Question {

	private int mId;
	private String mQuestion;
	private String mResponse;
	private Category mCategory;
	private int mCategoryId;
	private ResponseList mResponses;

	public Question(final Cursor cursor) {
		if (cursor != null && cursor.moveToFirst()) {
			mId = cursor.getInt(cursor.getColumnIndex(QuizzDroidConstants.ID));
			mQuestion = cursor.getString(cursor.getColumnIndex(QuizzDroidConstants.COLUMN_NAME_QUESTION));
			mResponse = cursor.getString(cursor.getColumnIndex(QuizzDroidConstants.COLUMN_NAME_RESPONSE));
			mCategoryId = cursor.getInt(cursor.getColumnIndex(QuizzDroidConstants.COLUMN_NAME_CATEGORY_ID));
		} else {
			throw new IllegalArgumentException("Cursor is null or empty");
		}
	}

	public int getId() {
		return mId;
	}

	public String getQuestion() {
		return mQuestion;
	}

	public String getResponse() {
		return mResponse;
	}

	public int getCategoryId() {
		return mCategoryId;
	}

	public Category getCategory() {
		return mCategory;
	}

	public void setCategory(final Category mCategory) {
		this.mCategory = mCategory;
	}

	public void setResponses(ResponseList mResponses) {
		this.mResponses = mResponses;
	}

	public ResponseList getResponses() {
		return mResponses;
	}

}
